package com.crm.mapper;

import com.crm.pojo.Goods;
import com.crm.pojo.client;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface goodsMapper {
    @Select("select * from goods")
    List<Goods> selectAll();

    @Select("select * from goods limit #{currentPage},#{pageSize}")
    List<Goods> selectByPage( @Param("currentPage") Integer currentPage,
                         @Param("pageSize") Integer pageSize);

    @Select("select * from goods where gid=#{id}")
    Goods selectById(int id);

    @Insert("insert into goods(name, company, sort, price, count) VALUES (#{name},#{company},#{sort},#{price},#{count})")
    boolean addGoods(Goods goods);

    @Update("update goods set name=#{name},company=#{company},sort=#{sort},price=#{price},count=#{count} where " +
            "gid=#{gid}")
    boolean updateGoods(Goods goods);

    @Delete("delete from goods where gid=#{id}")
    boolean deleteGoods(int id);

}
